package com.ruoyi.web.controller.report;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.TabPtdetail;
import com.ruoyi.system.service.ITabPtdetailService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 检查信息Controller
 *
 * @author jiadun
 * @date 2021-12-28
 */
@RestController
@RequestMapping("/reoprt/ptdetail")
public class TabPtdetailController extends BaseController
{
    @Autowired
    private ITabPtdetailService tabPtdetailService;

    /**
     * 查询检查信息列表
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(TabPtdetail tabPtdetail)
    {
        startPage();
        List<TabPtdetail> list = tabPtdetailService.selectTabPtdetailList(tabPtdetail);
        return getDataTable(list);
    }

    /**
     * 导出检查信息列表
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:export')")
    @Log(title = "检查信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TabPtdetail tabPtdetail)
    {
        List<TabPtdetail> list = tabPtdetailService.selectTabPtdetailList(tabPtdetail);
        ExcelUtil<TabPtdetail> util = new ExcelUtil<TabPtdetail>(TabPtdetail.class);
        util.exportExcel(response, list, "检查信息数据");
    }

    /**
     * 获取检查信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:query')")
    @GetMapping(value = "/{ptdeid}")
    public AjaxResult getInfo(@PathVariable("ptdeid") Long ptdeid)
    {
        return AjaxResult.success(tabPtdetailService.selectTabPtdetailByPtdeid(ptdeid));
    }

    /**
     * 新增检查信息
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:add')")
    @Log(title = "检查信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TabPtdetail tabPtdetail)
    {
        return toAjax(tabPtdetailService.insertTabPtdetail(tabPtdetail));
    }

    /**
     * 修改检查信息
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:edit')")
    @Log(title = "检查信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TabPtdetail tabPtdetail)
    {
        return toAjax(tabPtdetailService.updateTabPtdetail(tabPtdetail));
    }

    /**
     * 删除检查信息
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:remove')")
    @Log(title = "检查信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ptdeids}")
    public AjaxResult remove(@PathVariable Long[] ptdeids)
    {
        return toAjax(tabPtdetailService.deleteTabPtdetailByPtdeids(ptdeids));
    }


    /**
     * 获取检查信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('reoprt:ptdetail:queryById')")
    @GetMapping(value = "/{ptdeids}")
    public AjaxResult getByIdInfo(@PathVariable("ptdeids") Long ptdeid)
    {
        return AjaxResult.success(tabPtdetailService.selectTabPtdetailByPtdeid(ptdeid));
    }

}
